<%
	'response.write Session("VanBan")
	if Instr(Session("VanBan"),"-"& Request("IDFlow") &"-")=0 or Session("VanBan")="" then
		Response.Redirect(Session("URL")& "Error.asp?ErrorCode=3")
	end if
%>
<!--#include file="..\CheckSession.inc"-->
<%
 IDFlow=request("IDFlow")
 Nguoitao=request("Nguoitao")
 Filename=Request("Filename")
 UName=Request("Username")
 Hanxuly=Request("Hanxuly")
 Yeucau=Request("Yeucau")
 MaCB=Request("MaCB")
 Tentep=Request("Tentep")
 Maflow=Request("Maflow")
 bXem=request("bXem")
 bMaRoot=Request("bMaRoot")
 bDatao=request("bDatao") 
 '********************
 'bg thphuc 27-01-03 lay gia tri bcomm
 bComm=request("bComm")
 'ed thphuc 27-01-03 lay gia tri bcomm
 '********************
 Status=request("Status")
 IDFlow=request("IDFlow")

'bg thphuc 27-01-03 y kien xu ly
if bComm="xulyok" then
	lnk="xulyyeucau.asp?uname="& uname &"&bdatao="& bdatao &"&bmaroot="& bmaroot &"&maflow="& maflow &"&macb="& macb &"&yeucau="& yeucau &"&idflow="& idflow &"&nguoitao="& nguoitao &"&hanxuly="& hanxuly &"&bComm="& bComm &"&Status="& Status &"&Filename="& Filename &"&Tentep="& Tentep
else
'ed thphuc 27-01-03 y kien xu ly
		if Status="2" then
			sSQL="Update Flownode Set trangthaixl=2 where trangthaiXL<>-1 And Maworkflownode like '"& Request("Maflow") &"' and nguoixuly like '"& Session("bMaCB") &"'"
			Conn.Execute sSQL
		else
			if Status="1" then
				sSQL="Update Flownode Set trangthaixl=1 where trangthaiXL<>-1 And Maworkflownode like '"& Request("Maflow") &"' and nguoixuly like '"& Session("bMaCB") &"'"
				Conn.Execute sSQL
			else
				Set Rec=server.CreateObject("ADODB.Recordset")
				Rec.CursorType=3
				Rec.CacheSize=5
				sSQL="Select * from Flownode where Maworkflow like '"& IDFlow &"' and nguoixuly like '"& Session("bMaCB") &"'"
				Rec.Open sSQL,Conn	
				do while not Rec.EOF
					if ((rec("Trangthaixl")=0) or (rec("Trangthaixl")=null)) then
						if rec("yeucauxl")="1" then
							sSQL="Update Flownode Set trangthaixl=1 where trangthaiXL<>-1 And Maworkflownode like '"& Rec("Maworkflownode") &"'"' and nguoixuly like '"& Session("bMaCB") &"'"
						else
							sSQL="Update Flownode Set trangthaixl=2,thuhoi=1 where trangthaiXL<>-1 And Maworkflownode like '"& Rec("Maworkflownode") &"'"' and nguoixuly like '"& Session("bMaCB") &"'"
						end if
						Conn.Execute sSQL
					end if
					Rec.MoveNext
				Loop
			end if
	'bg thphuc 27-01-03 y kien xu ly
		end if
	'ed thphuc 27-01-03 y kien xu ly
 '********************

 if bXem="xem" then
	lnk="xulyyeucau.asp?bDatao="& bDatao &"&bComm=flow&bXem=xem&IDflow=" & IDflow & "&Nguoitao=" & nguoitao  &"&Maflow=" & maflow & "&Uname=" & Uname & "&Hanxuly=" & hanxuly
	lnk=lnk+"&Yeucau=" & yeucau & "&MaCB=" & MaCB &"&bmaroot=" & bmaroot &"&Status="& Status
	Response.Redirect(lnk)	
 else
'	lnk="xulyyeucau.asp?bDatao="& bDatao &"&IDflow=" & IDflow & "&Nguoitao=" & nguoitao & "&Uname=" & Uname & "&Hanxuly=" & hanxuly
'	lnk=lnk+"&Yeucau=" & yeucau & "&MaCB=" & MaCB & "&Maflow=" & maflow & "&bMaRoot=" & bMaRoot	
'bg thphuc xu ly yeu cau
	lnk="xulyyeucau.asp?uname="& uname &"&bdatao="& bdatao &"&bmaroot="& bmaroot &"&maflow="& maflow &"&macb="& macb &"&yeucau="& yeucau &"&idflow="& idflow &"&nguoitao="& nguoitao &"&hanxuly="& hanxuly  &"&Status="& Status
'ed thphuc xu ly yeu cau
 end if 
end if
 %>
<frameset rows="27%,*">  
  <frame name="xuly" src=<%=lnk%>>
  <frame name="xem" src="Xemnoidung.asp?bDatao=<%=bDatao%>&bXuly=ok&bMa=<%=IDflow%>&Maflow=<%=Maflow%>"> 
</frameset>
</html>